#include "kinectgamelogic.h"


#include "logging.h"

KinectGameLogic::KinectGameLogic(NUI_IMAGE_RESOLUTION _colorResolution, 
	NUI_IMAGE_RESOLUTION _depthResolution,
	int _outputTexResX, int _outputTexResY)
	: mKinColorRes(_colorResolution),
	mKinDepthRes(_depthResolution),
	mKinTexWidth(_outputTexResX),
	mKinTexHeight(_outputTexResY)
{
	Init();
}

KinectGameLogic::~KinectGameLogic()
{
	if (mKinectMgr)
	{
		mKinectMgr->NuiUnInit();
		delete mKinectMgr;
		mKinectMgr = 0;
	}
}

void KinectGameLogic::Init()
{
	if (!InitKinect())
	{
		Logging::getSingleton().Output("No kinect found!\n");
		exit(1);
	}
}

void KinectGameLogic::Update(float _elapseTime)
{

}

void KinectGameLogic::Render()
{

}

bool KinectGameLogic::InitKinect()
{
	mKinectMgr = new KinectWinMgr(mKinColorRes, mKinDepthRes, mKinTexWidth, mKinTexHeight);
	if ( !mKinectMgr->NuiInit())
	{
		return false;
	}
	mKinectMgr->SetEnableDrawSkeleton(true);

	return true;
	
}